<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>我是b页面</h1>
    <div class="box">我是div</div>
</body>
</html>
<script>
    let searchstr = window.location.search;
    var type = searchstr.substr(1);
    console.log(type);
    type = type.split("=")[1];
    console.log(type);

    if(type == 1){
        document.querySelector(".box").style.background = "red";
    }else{
        document.querySelector(".box").style.background = "blue";
    }

</script>